package com.feinno.module.security;

import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.feinno.framework.utils.ConfigurableConstants;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

/**
 * 基础安全框架常量
 * 
 * @author zhangpu
 * 
 */
public final class SecurityConstants extends ConfigurableConstants {

	// 静态初始化读入portal.properties中的设置
	static {
		init("spring/module/security/security.properties");
	}
	
	public static final String USER_TYPE_MAPPING = getProperty("user.type.mapping", "{\"1\":\"管理员\",\"2\":\"操作员\"}");
	public static final String USER_STATUS_MAPPING = getProperty("user.status.mapping", "{\"1\":\"有效\",\"2\":\"无效\"}");
	
	public static final String FRAMWORK_ICONS = getProperty("framwork.icons", "icon-system");
	public static final List<String> FRAMEWORK_ALL_ICONS = Lists.newArrayList(StringUtils.split(FRAMWORK_ICONS, ","));
	
	public static final String FRAMWORK_MENU_ICON_PATH = getProperty("framwork.menu.icon.path", "/admin/images/icon/");
	public static final String FRAMWORK_MENU_ICON_FILES = getProperty("framwork.menu.icon.files", "menu1.gif|menu2.gif|menu3.gif");

	public static final int SHOW_STATE_YES = 0;
	public static final int SHOW_STATE_NO = 1;
	public static final Map<Integer,String> SHOW_STATE_MAPPING = Maps.newTreeMap();
	public static final int SHOW_MODE_AJAXLOAD = 1;
	public static final int SHOW_MODE_IFRAME = 2;
	public static final Map<Integer,String> SHOW_MODE_MAPPING = Maps.newTreeMap();	
	static
	{
		SHOW_STATE_MAPPING.put(SHOW_STATE_YES, "显示");
		SHOW_STATE_MAPPING.put(SHOW_STATE_NO, "隐藏");
		SHOW_MODE_MAPPING.put(SHOW_MODE_AJAXLOAD, "AJAX加载");
		SHOW_MODE_MAPPING.put(SHOW_MODE_IFRAME, "Iframe加载");
	}
}
